
<%@ page import="org.tailor.Shirt"%>
<html>
<head>

<meta name="layout" content="mainLayout" />
<g:set var="entityName"
	value="${message(code: 'shirt.label', default: 'Shirt')}" />

	
</head>
<body>
	<div id="col_middle">
	<h1>
			<g:message code="Search Shirt"  />
		</h1><br/>
	<div class="body">
		<g:form action="search">

			<table width="100%">
				<tr id="searchLabel">
					<td><label for="Search Value">Shirt Name</label>
					</td>
					<td><g:textField name="shirtName" value="${shirtName}"/><br/><br/>
					</td>
				</tr>
				<tr id="searchLabel">
					<td><label for="Search Value">Region</label>
					</td>
					<td>
					
					<g:select name="regionNameSelected"
							from="${org.tailor.Regions.listOrderByregionName()}"
							optionValue="regionName" optionKey="regionID" value="${regionId}" noSelection="['0':'Select Region']"		
/><br/><br/>

</td>

				</tr>
				<tr id="searchLabel">
					<td><label for="Search Value">Fabric</label>
					</td>
					<td><g:select name="fabricSelected"
							from="${org.tailor.Fabric.listOrderByfabricType()}"
							optionValue="fabricType" optionKey="id" value="${id}"
							noSelection="['null':'Select Fabric']" /><br/><br/>
					</td>

				</tr>
				<tr>
					<td><label for="Search Value">&nbsp;</label>
					</td>

					<td><g:submitButton name="search" class="searchShirt"
							value="Search" />
					</td>
				</tr>
			</table>

		</g:form>
		<g:if test="${flash.message}">
			<div class="message">
				${flash.message}
			</div>
		</g:if>
<g:if test="${shirtList}">

		<div class="list">
		
			<table>
                    <thead>
                        <tr>
                         <th><g:message code="shirt.id.label" default="Id" /></th>
                            
                         <th><g:message code="shirt.shirtID.label" default="Shirt ID" /></th>
                         
                           <th><g:message code="shirt.shirtName.label" default="Shirt Name" /></th>
                           
                         <th><g:message code="shirt.shirtName.label" default="Design Name" /></th>
                         
                         <th><g:message code="shirt.collar.label" default="Collar" /></th>
                        
                         <th><g:message code="shirt.cuff.label" default="Cuff" /></th>
                         
                         <th><g:message code="shirt.designName.label" default="Design Picture" /></th>
                            
                        
                        </tr>
                    </thead>
                    <tbody>
                    
                    <g:each in="${regionList}" status="j" var="regionInstance">
                    <tr><td colspan="7"><h1>Region:&nbsp;${fieldValue(bean: regionInstance.tailor.regions, field: "regionName")}</h1></td>
                                     
                    </tr>
                    
                    <g:each in="${shirtList}" status="i" var="shirtInstance">
                    <g:if test="${fieldValue(bean: regionInstance.tailor.regions, field: 'regionID')==fieldValue(bean: shirtInstance.tailor.regions, field: 'regionID')}" >
                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                        
                            <td><g:link action="show" id="${shirtInstance.id}">${fieldValue(bean: shirtInstance, field: "id")}</g:link></td>
                        
                            <td>${fieldValue(bean: shirtInstance, field: "shirtID")}</td>
                        
                        	<td>${fieldValue(bean: shirtInstance, field: "shirtName")}</td>
                        	
                            <td>${fieldValue(bean: shirtInstance, field: "designName")}</td>
                        
                            <td>${fieldValue(bean: shirtInstance.collar, field: "collarName")}</td>
                        
                            <td>${fieldValue(bean: shirtInstance.cuff, field: "cuffName")}</td>
                        
                            <td>
							<img src="<g:createLink controller='shirt' action='renderImage' id='${fieldValue(bean: shirtInstance, field:"id")}'/>"
				 width="120" height="120"	title="${fieldValue(bean: shirtInstance, field:"id")}"
				alt="No Photo" /></td>
                        
                        </tr>
                     </g:if>
                    </g:each>
                     </g:each>
                    </tbody>
                </table>
		</div>
		</g:if>
		
		<%--<div class="paginateButtons">
			<g:paginate total="${shirtInstanceTotal}" />
		</div>
	--%></div></div>
</body>
</html>
